//
//  WBStatusCell.swift
//  weibo
//
//  Created by iobit on 2017/07/06.
//  Copyright © 2017 zhuxu. All rights reserved.
//

import UIKit

class WBStatusCell: UITableViewCell {

    var viewModel: WBStatusViewModel? {
        didSet {
            // 设置内容正文
            statusLabel.text = viewModel?.status.text
            // 设置名字
            nameLabel.text = viewModel?.status.user?.screen_name
            // 设置会员图标 注：图片最高只到VIP6，所以7以上用户显示没有vip
            memberIconView.image = viewModel?.memberIcon
            // 设置VIP认证图标
            vipIconView.image = viewModel?.vipIcon
            // 设置头像
            iconView.cz_setImage(urlString: viewModel?.status.user?.profile_image_url, placeholderImage: UIImage(named: "avatar_default_big"), isAvatar: true)
            // 设置底部工具栏
            toolBar.viewModel = viewModel
            
            // 测试修改配图高度
            pictureView.heightCons.constant = viewModel?.pictureViewSize.height ?? 0
            pictureView.urls = viewModel?.status.pic_urls
            
        }
    }
    
    
    
    /// 头像
    @IBOutlet weak var iconView: UIImageView!
    
    /// 姓名
    @IBOutlet weak var nameLabel: UILabel!
    
    /// 会员图标
    @IBOutlet weak var memberIconView: UIImageView!
    
    /// 时间
    @IBOutlet weak var timeLabel: UILabel!
    
    /// 来源
    @IBOutlet weak var sourceLabel: UILabel!
    
    /// vip认证图标
    @IBOutlet weak var vipIconView: UIImageView!
    
    /// 正文
    @IBOutlet weak var statusLabel: UILabel!
    
    /// 底部工具栏
    @IBOutlet weak var toolBar: WBStatusToolBar!
    
    /// 配图视图
    @IBOutlet weak var pictureView: WBStatusPictureView!
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
